﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebApplicationCultura.Clases;

namespace WebApplicationCultura.Pages.Actividades
{
    public partial class actividadesevento : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpCookie cookie = Request.Cookies["idEvento"];
            if (cookie != null)
            {
                culturaDataContext cdc = new culturaDataContext();
                var evento = from ev in cdc.EVENTOs where ev.ID_EVENTO == decimal.Parse(cookie.Value) select ev;
                this.Label1.Text = evento.First().NOMBRE_EVENTO;

            }
            else
            {
                Response.Write("<p>Error, cookie no encontrada.</p>");
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            HttpCookie nombreEvento = new HttpCookie("nombreEvento");
            nombreEvento.Value = this.Label1.Text.Trim();
            Response.Cookies.Add(nombreEvento);
            Response.Redirect("/Pages/Actividades/nuevaactividad.aspx");
        }
    }
}